//
//  AEPersonInfoViewCell.m
//  AESOLAR_IOS
//
//  Created by Bin Tang on 2024/10/12.
//  Copyright © 2024 Mr.Wang. All rights reserved.
//

#import "AEPersonInfoViewCell.h"

@interface AEPersonInfoViewCell ()

@property (nonatomic, strong) TYZCommonCellModel *model;

@property (nonatomic, strong) UILabel *titleLabel;

@property (nonatomic, strong) UILabel *valueLabel;

@end

@implementation AEPersonInfoViewCell

- (void)initWithSubViewCell {
    [super initWithSubViewCell];
    
    self.contentView.backgroundColor = kWhiteColor;
}

- (void)initWithTitleLabel {
    if (!_titleLabel) {
        CGRect frame = CGRectMake(20, 14, 0, 22);
        _titleLabel = [UILabel createWithLabel:self.contentView frame:frame font:[UIFont systemFontOfSize:16 weight:UIFontWeightMedium] propertiesBlock:^(UILabel * _Nonnull label) {
            label.textColor = [UIColor colorWithHexString:@"#333333"];
        }];
    }
    if (self.model) {
        self.titleLabel.width = self.model.titleWidth;
        self.titleLabel.text = self.model.title;
    }
}

- (void)initWithValueLabel {
    if (!_valueLabel) {
        CGRect frame = CGRectMake(0, 14, 0, 22);
        _valueLabel = [UILabel createWithLabel:self.contentView frame:frame font:[UIFont systemFontOfSize:16 weight:UIFontWeightMedium] propertiesBlock:^(UILabel * _Nonnull label) {
            label.textColor = [UIColor colorWithHexString:@"#999999"];
            label.numberOfLines = 0;
            label.textAlignment = NSTextAlignmentRight;
        }];
    }
    if (self.model) {
        self.valueLabel.left = self.titleLabel.right;
        self.valueLabel.width = kScreenW - self.titleLabel.right - 20;
        self.valueLabel.height = self.model.valueHeight;
        self.valueLabel.text = self.model.value;
    }
}

- (void)updateCellData:(id)cellEntity {
    self.model = cellEntity;
    
    [self initWithTitleLabel];
    
    [self initWithValueLabel];
    
}


@end
